{config_load file='site.conf' section='ad_index'}
{include file='header.tpl'}
{literal}
 <SCRIPT LANGUAGE="JavaScript">
 <!--
 	 $(document).ready(function()
	{
		$("#tb_list tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
		$("#tb_list tr:even").addClass("alt");
		
		$("#myForm").validate({
			rules: {
				ad_name: "required",
				core_link: {
					url: true
				}
			},
			messages: {
				ad_name: "広告名は必須です",
				core_link: {
					url: "正しくURLを入力してください。"
				}
			}
		});
	}
	);
					   
	function doDelAd(adspace_id)
	{
		if(confirm("本当に広告["+adspace_id+"]を削除しますか"))
		{
			$("#actionType").attr("value","del");
			$("#adspace_id").attr("value",adspace_id);
			$("#delForm").submit();
		}
	}
	
	function doEditAd(adspace_id)
	{
		$("#actionType").attr("value","view");
		$("#adspace_id").attr("value",adspace_id);
		$("#delForm").attr("method","post");
		$("#delForm").attr("action","ad_edit.php");
		$("#delForm").submit();
	}
 //-->
 </SCRIPT>
{/literal}
<div id="bg">
	<div id="page">
		<div id="content">
        	{if $msg ne ""}<div class="errorMsg">{$msg}</div>{/if}
			<div class="post">
				<h2 class="title">広告登録</h2>
            </div>	
			<div class="post">
				<div class="entry">
								
				<form id="myForm" action="{$SCRIPT_NAME}" method="post">
                <input type="hidden" name="actionType" id="actionType" value="insert"/>
				<table width="600" id="tb_form">
				  <tr>
				    <th width="150" >広告名<span class="required">(必須)</span></th>
				    <td width="450" ><input name="ad_name" type="text" id="ad_name" size="50" maxlength="200" ></td>
				  </tr>
				  <tr>
				    <th>広告タイプ</th>
				    <td>{html_options name=type options=$adTypeList }</td>
				  </tr>
				  <tr>
				    <th>コース変更広告</th>
				    <td>{html_options name=type_c options=$cTypeList }</td>
				  </tr>
				  <tr>
				    <th>アダルト広告フラグ</th>
				    <td>{html_options name=adult_ok options=$adultOkList }</td>
				  </tr>
				  <tr>
				    <th>公開フラグ</th>
				    <td>
					{html_options name=open_flag options=$openFlagList }
					</td>
				  </tr>
				   <tr>
				    <th>広告内容</th>
				    <td>
					<textarea name="tag_contents" id="tag_contents" cols="60" rows="6" ></textarea>			
					</td>
				  </tr>
					<tr>
					<th>広告リンク</th>
					<td>
					<input name="core_link" type="text" id="core_link" size="50" maxlength="200" value="{$rslt.core_link|escape}">			
					</td>
				  </tr>
				  <tr>
				    <th width="150" >&nbsp;</th>
				    <td width="450" >       
					<input type="submit" value="登録" class="submitButton">
				    <input type="reset"  value="リセット" class="submitButton">
					</td>
				  </tr>
				</table>
				</form>
				</div>
			</div>	
			<div class="post">	
			<h2 class="title">広告枠一覧</h2>

            <form id="delForm" ction="{$SCRIPT_NAME}" method="post">
                <input type="hidden" name="actionType" id="actionType" value="del"/>
				<input type="hidden" name="adspace_id" id="adspace_id"/>
            </form>
				<div class="entry">
				{$paging}
                <table width="350"  id="tb_list" >
                  <tr bgcolor="#CC0000">
                    <th>広告ID</th>
                    <th>広告名</th>
                    <th>広告タイプ<br/>(PCorモバイル)</th>
                    <th>コース変更広告<br/>(0:該当なし,1:DL10,,,)</th>
                    <th>アダルト広告フラグ<br/>(○or×)</th>
					<th>公開フラグ<br/>(○or×)</th>
					<th>登録日時</th>
                    <th>&nbsp;</th>
                  </tr>
				  
				  {foreach from=$resultlist item=row}
    				<tr bgcolor="#FFFFFF">
	                	<td>{ $row.adspace_id }</td>
    					<td>{ $row.ad_name }</td>
    					<td>{if $row.type == 1}PC{else}モバイル{/if}</td>
    					<td>{ $row.type_c }</td>
						<td>{if $row.adult_ok == 1}○{else}×{/if}</td>
						<td>{if $row.open_flag == 1}○{else}×{/if}</td>
						<td>{ $row.regist_date }</td>
    					<td><a href="#" OnClick="doEditAd({$row.adspace_id});">編集</a> <a href="#" OnClick="doDelAd({$row.adspace_id});">削除</a></td>
                 	 </tr>
				  {/foreach}
                </table>
				{$paging}
			  </div>
			</div>
		</div>
		<!-- end #content -->
		<!-- end #sidebar -->
		<div style="clear: both; height: 20px;">&nbsp;</div>
	</div>
	<!-- end #page -->
</div>
{include file='footer.tpl'}



